<template>
  <div class="background" id="background">
    <div>
      <div style="display: flex; align-items: center; margin-bottom: 30px;">
        <div>
          <b>
            <h4
              style="font-family: '微软雅黑', Times, serif, cursive; font-weight: bold; color: white; font-size: 30px; margin-top: 30px; margin-left: 30px;">
              教务管理系统</h4>
            <h2><a href="https://zjj.jsu.edu.cn/p1/index.html" style="color: #000;text-decoration: none;font-family: 宋体;">以人名校
                以业报国</a></h2>
            <div>
              <p><a href="https://cas.zjjxy-zhxy.net/lyuapServer/login?service=https://portal.zjjxy-zhxy.net/shiro-cas"
                  style="color: #2eb380;text-decoration: none;font-size: 20px;">张院信息门户></a></p>
            </div>
          </b>
        </div>
      </div>
      <div style="width: 100%; display: flex; justify-content: flex-end;">
        <div class="login-container">
          <div class="login-tabs">
            <div class="login-tab" :class="{ active: activeTab === 'account' }" id="login-account-tab"
              @click="showAccountTab">教师登录</div>
            <div class="login-tab" :class="{ active: activeTab === 'admin' }" id="login-admin-tab" @click="showAdminTab">
              管理员登录</div>
          </div>
          <div class="login-web input" style="margin-top: 10px;" v-show="activeTab === 'account'">
            <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="0">
              <el-form-item prop="no">
                <el-input placeholder="请输入教师工号" v-model="ruleForm.no"></el-input>
              </el-form-item>
              <el-form-item prop="password">
                <el-input placeholder="请输入密码" type="password" v-model="ruleForm.password"></el-input>
              </el-form-item>
              <el-form-item>
                <el-button type="primary" @click="login">登录</el-button>
              </el-form-item>
            </el-form>
          </div>
          <div class="login-web input" style="margin-top: 10px;" v-show="activeTab === 'admin'">
            <el-form :model="adminForm" :rules="adminRules" ref="adminForm" label-width="0">
              <el-form-item prop="adminId">
                <el-input placeholder="请输入管理员账号" v-model="adminForm.adminId"></el-input>
              </el-form-item>
              <el-form-item prop="adminPassword">
                <el-input placeholder="请输入密码" type="password" v-model="adminForm.adminPassword"></el-input>
              </el-form-item>
              <el-form-item>
                <el-button type="primary" @click="adminLogin">登录</el-button>
              </el-form-item>
            </el-form>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import axios from 'axios'

export default {
  data() {
    return {
      activeTab: 'account',
      ruleForm: {
        no: '',
        password: '',
      },
      rules: {
        no: [
          { required: true, message: '请输入教师工号', trigger: 'blur' },
        ],
        password: [
          { required: true, message: '请输入密码', trigger: 'change' },
        ],
      },
      adminForm: {
        adminId: '',
        adminPassword: '',
      },
      adminRules: {
        adminId: [
          { required: true, message: '请输入管理员账号', trigger: 'blur' },
        ],
        adminPassword: [
          { required: true, message: '请输入密码', trigger: 'change' },
        ],
      },
    }
  },
  methods: {
    login() {
      // 处理教师登录逻辑
    },
    adminLogin() {
      // 处理管理员登录逻辑
    },
    showAccountTab() {
      this.activeTab = 'account'; // 显示教师登录
    },
    showAdminTab() {
      this.activeTab = 'admin'; // 显示管理员登录
    },
  }
}
</script>

<style scoped>
h4 {
  left: 190px;
  top: 20px;
  font-size: 30px;
}

.login-container {
  width: 400px;
  margin-right: 5%;
  margin-top: 100px;
  background: rgba(255, 255, 255, 0.733);
}

.login-tabs {
  display: flex;
}

.login-tab.active {
  border-bottom: 2px solid #123081;
  color: #123081;
  padding: 20px;
  font-size: 20px;
  margin: 0 auto;
}

.login-tab {
  color: #000000;
  padding: 20px;
  font-size: 20px;
  margin: 0 auto;
}

/deep/.el-input__inner {
  padding: 20px;
}

/deep/ .el-button {
  width: 600px;
}

/deep/ .el-form {
  width: 300px;
  margin: 0 auto;
}

.background {
  background-image: url("https://zjj.jsu.edu.cn/u/cms/www/202305/17173220mo18.jpg");
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  margin: 0 auto;
}

h2 {
  position: absolute;
  left: 145px;
  top: 260px;
  font-size: 35px;
  font-family: "华文宋体";
}


p {
  position: absolute;
  left: 146px;
  top: 320px;
  font-size: 15px;
  font-family: "楷书";
}
</style>